package com.iot.manage.service;

import com.alibaba.fastjson.JSONObject;
import com.iot.manage.dao.SysCodeMapper;
import com.iot.manage.pojo.SysCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysCodeService {

    @Autowired
    private SysCodeMapper sysCodeMapper;

    public List<SysCode> findSysCodeList(String query, int pagenum, int pagesize) {
        return sysCodeMapper.findSysCodeList(query,pagesize * (pagenum - 1),pagesize * pagenum);
    }

    public int countSysCodeList(String query) {
        return sysCodeMapper.countSysCodeList(query);
    }

    public void addSysCodeInfo(JSONObject params) {
        sysCodeMapper.addSysCodeInfo(params);
    }

    public SysCode findSysCodeInfoBySysCodeTypeAndCodeName(String sysCodeType, String codeName) {
        return sysCodeMapper.findSysCodeInfoBySysCodeTypeAndCodeName(sysCodeType,codeName);
    }

    public void updateSysCodeInfo(JSONObject params) {
        sysCodeMapper.updateSysCodeInfo(params);
    }

    public void removeSysCodeInfo(String sysCodeType,String codeName) {
        sysCodeMapper.removeSysCodeInfo(sysCodeType,codeName);
    }

}
